﻿<phone:PhoneApplicationPage 
    x:Class="DiamondDash.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:my="clr-namespace:DiamondDash.Views"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="False">
	<phone:PhoneApplicationPage.Resources>
		<Style x:Key="ButtonStyleNewGame" TargetType="Button">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="Button">
						<Grid>
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Pressed">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="image">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Collapsed</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="image1">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="Disabled"/>
									<VisualState x:Name="MouseOver"/>
								</VisualStateGroup>
								<VisualStateGroup x:Name="FocusStates">
									<VisualState x:Name="Focused"/>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Image x:Name="image" Source="/Images/btnNewGame.png" Stretch="Fill"/>
							<Image x:Name="image1" Source="/Images/btnNewGamePress.png" Stretch="Fill" Visibility="Collapsed"/>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="ButtonStyleRanking" TargetType="Button">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="Button">
						<Grid>
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Pressed">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="image">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="image1">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Collapsed</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="Disabled"/>
									<VisualState x:Name="MouseOver"/>
								</VisualStateGroup>
								<VisualStateGroup x:Name="FocusStates">
									<VisualState x:Name="Focused"/>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Image x:Name="image1" Source="/Images/btnRanking.png" Stretch="Fill"/>
							<Image x:Name="image" Source="/Images/btnRankingPress.png" Stretch="Fill" Visibility="Collapsed"/>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="ButtonStyle4" TargetType="Button">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="Button">
						<Grid>
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Pressed">
										<Storyboard>
											<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="contentPresenter" d:IsOptimized="True"/>
											<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="contentPresenter" d:IsOptimized="True"/>
											<DoubleAnimation Duration="0" To="1.05" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="border" d:IsOptimized="True"/>
											<DoubleAnimation Duration="0" To="1.05" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="contentPresenter" d:IsOptimized="True"/>
											<DoubleAnimation Duration="0" To="1.05" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="border" d:IsOptimized="True"/>
											<DoubleAnimation Duration="0" To="1.05" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="contentPresenter" d:IsOptimized="True"/>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="Disabled">
										<Storyboard>
											<DoubleAnimation Duration="0" To="0.3" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter" d:IsOptimized="True"/>
											<ColorAnimation Duration="0" To="#FF6C6C6C" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="border" d:IsOptimized="True"/>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="MouseOver"/>
								</VisualStateGroup>
								<VisualStateGroup x:Name="FocusStates">
									<VisualState x:Name="Focused"/>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Border x:Name="border" BorderBrush="#FF400000" BorderThickness="2" HorizontalAlignment="Left" Height="51" VerticalAlignment="Top" Width="204" CornerRadius="7" RenderTransformOrigin="0.5,0.5">
								<Border.RenderTransform>
									<CompositeTransform/>
								</Border.RenderTransform>
								<Border.Background>
									<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
										<GradientStop Color="#FFF55858" Offset="0"/>
										<GradientStop Color="#FF910606" Offset="1"/>
										<GradientStop Color="#FF660900" Offset="0.168"/>
									</LinearGradientBrush>
								</Border.Background>
							</Border>
							<ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RenderTransformOrigin="0.5,0.5">
								<ContentPresenter.RenderTransform>
									<CompositeTransform/>
								</ContentPresenter.RenderTransform>
							</ContentPresenter>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="ButtonStyleClose" TargetType="Button">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="Button">
						<Grid x:Name="grid" RenderTransformOrigin="0.5,0.5">
							<Grid.RenderTransform>
								<CompositeTransform/>
							</Grid.RenderTransform>
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Pressed">
										<Storyboard>
											<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="grid" d:IsOptimized="True"/>
											<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="grid" d:IsOptimized="True"/>
											<DoubleAnimation Duration="0" To="1.05" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="grid" d:IsOptimized="True"/>
											<DoubleAnimation Duration="0" To="1.05" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="grid" d:IsOptimized="True"/>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="Disabled"/>
									<VisualState x:Name="MouseOver"/>
								</VisualStateGroup>
								<VisualStateGroup x:Name="FocusStates">
									<VisualState x:Name="Focused"/>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Ellipse Width="37" VerticalAlignment="Top" Stroke="White" Height="37" HorizontalAlignment="Left" Fill="#FF890000"/>
							<Path Width="20.254" VerticalAlignment="Center" UseLayoutRounding="False" StrokeThickness="5" Stroke="White" Stretch="Fill" Height="20.254" HorizontalAlignment="Center" Fill="#FF890000" Data="M265,10 L284.254,29.2542"/>
							<Path Width="20.254" VerticalAlignment="Center" UseLayoutRounding="False" StrokeThickness="5" Stroke="White" Stretch="Fill" RenderTransformOrigin="0.5,0.5" Margin="8.373" Height="20.254" HorizontalAlignment="Center" Fill="#FF890000" Data="M265,10 L284.254,29.2542">
								<Path.RenderTransform>
									<CompositeTransform Rotation="90"/>
								</Path.RenderTransform>
							</Path>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="ButtonStyleGiftPackage" TargetType="Button">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="Button">
						<Grid>
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Pressed">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="image">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Visible</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="image1">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Collapsed</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="Disabled"/>
									<VisualState x:Name="MouseOver"/>
								</VisualStateGroup>
								<VisualStateGroup x:Name="FocusStates">
									<VisualState x:Name="Focused"/>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Image x:Name="image1" Source="/Images/btnGiftPackage.png" Stretch="Fill"/>
							<Image x:Name="image" Source="/Images/btnGiftPackagePress.png" Stretch="Fill" Visibility="Collapsed"/>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
        <Storyboard x:Name="StoryboardShowPackage">
            <DoubleAnimation Duration="0:0:0.4" To="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="bdrNewUser" d:IsOptimized="True"/>
        </Storyboard>
        <Storyboard x:Name="StoryboardHidePackage">
            <DoubleAnimation Duration="0:0:0.4" To="-800" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="bdrNewUser" d:IsOptimized="True"/>
        </Storyboard>
        <Style x:Key="ButtonStyleSoundOff" TargetType="Button">
        	<Setter Property="Template">
        		<Setter.Value>
        			<ControlTemplate TargetType="Button">
        				<Grid Background="#02FFFFFF">
        					<VisualStateManager.VisualStateGroups>
        						<VisualStateGroup x:Name="CommonStates">
        							<VisualState x:Name="Normal"/>
        							<VisualState x:Name="Disabled"/>
        							<VisualState x:Name="MouseOver"/>
        						</VisualStateGroup>
        						<VisualStateGroup x:Name="FocusStates">
        							<VisualState x:Name="Focused"/>
        						</VisualStateGroup>
        					</VisualStateManager.VisualStateGroups>
        					<Image Source="/Images/sound_mute.png" Stretch="Fill"/>
        				</Grid>
        			</ControlTemplate>
        		</Setter.Value>
        	</Setter>
        </Style>
        <Style x:Key="ButtonStyleSoundOn" TargetType="Button">
        	<Setter Property="Template">
        		<Setter.Value>
        			<ControlTemplate TargetType="Button">
        				<Grid Background="#02FFFFFF">
        					<VisualStateManager.VisualStateGroups>
        						<VisualStateGroup x:Name="CommonStates">
        							<VisualState x:Name="Normal"/>
        							<VisualState x:Name="Disabled"/>
        							<VisualState x:Name="MouseOver"/>
        						</VisualStateGroup>
        						<VisualStateGroup x:Name="FocusStates">
        							<VisualState x:Name="Focused"/>
        						</VisualStateGroup>
        					</VisualStateManager.VisualStateGroups>
        					<Image Source="/Images/sound_high.png" Stretch="Fill"/>
        				</Grid>
        			</ControlTemplate>
        		</Setter.Value>
        	</Setter>
        </Style>
    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot 是包含所有页面内容的根网格-->
    <Viewbox>
		<Grid x:Name="LayoutRoot" Height="800" Width="480">
			<Image Source="/Images/MainPage.png" Stretch="Fill"/>
			<Button x:Name="btnNewGame" Content="Button" HorizontalAlignment="Center" Height="76" Margin="118,472,105,0" Style="{StaticResource ButtonStyleNewGame}" VerticalAlignment="Top" Width="257" Click="btnNewGame_Click"/>
			<Button x:Name="btnRanking" Content="Button" HorizontalAlignment="Center" Height="73" Margin="0,583,0,144" Style="{StaticResource ButtonStyleRanking}" VerticalAlignment="Center" Width="214" Click="btnRanking_Click"/>
			<my:LevelProgressView x:Name="levelProgress" HorizontalAlignment="Left" Margin="299,6,0,0" VerticalAlignment="Top"/>
			<Button x:Name="btnGift" Content="Button" Margin="0,348,0,358" Style="{StaticResource ButtonStyleGiftPackage}" Width="291" Height="94" HorizontalAlignment="Center" Click="btnGift_Click"/>
			<Border x:Name="bdrNewUser" BorderBrush="Black" BorderThickness="1" Margin="0" Background="#CC000000" RenderTransformOrigin="0.5,0.5">
				<Border.RenderTransform>
					<CompositeTransform TranslateY="-800"/>
				</Border.RenderTransform>
				<Border BorderBrush="White" BorderThickness="1" HorizontalAlignment="Center" Height="358" VerticalAlignment="Center" Width="300" Background="#7FE8E8E8" CornerRadius="10">
					<Grid>
						<Image Source="/Images/coin.png" Stretch="Fill" HorizontalAlignment="Center" Width="89" Height="89" VerticalAlignment="Top" Margin="59,10,150,0"/>
						<TextBlock HorizontalAlignment="Center" Margin="4,125,2,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FFFFE800" FontSize="24" Width="292" TextAlignment="Center">
							<Run Text="给"/>
							<Run FontSize="32" FontFamily="Segoe WP Black" Text="五星">
								<Run.Foreground>
									<SolidColorBrush Color="#FFFF5100">
										<SolidColorBrush.RelativeTransform>
											<MatrixTransform Matrix="Identity"/>
										</SolidColorBrush.RelativeTransform>
										<SolidColorBrush.Transform>
											<MatrixTransform Matrix="Identity"/>
										</SolidColorBrush.Transform>
									</SolidColorBrush>
								</Run.Foreground>
							</Run>
							<Run Text="好评"/>
						</TextBlock>
						<TextBlock HorizontalAlignment="Center" Margin="0,171,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FFFFE800" FontSize="24" Text="免费获得10,000金币"/>
						<Button x:Name="btnGetMB" Click="btnGetMB_Click_1" Content="前往评分" HorizontalAlignment="Center" Margin="47,275,47,0" VerticalAlignment="Top" Style="{StaticResource ButtonStyle4}" Foreground="White"/>
						<Button x:Name="btnCloseGift" Click="btnCloseGift_Click_1" Content="Button" Margin="256,3,5,316" Style="{StaticResource ButtonStyleClose}"/>
						<TextBlock HorizontalAlignment="Left" Margin="143,57,0,0" TextWrapping="Wrap" Text="×10,000" VerticalAlignment="Top" FontSize="32" Foreground="White"/>
					</Grid>
				</Border>
			</Border>
			<Button x:Name="btnSoundOff" Click="btnSoundOff_Click" Content="Button" Margin="12,743,420,9" Style="{StaticResource ButtonStyleSoundOff}" Visibility="Collapsed"/>
			<Button x:Name="btnSoundOn" Click="btnSoundOn_Click" Content="Button" Margin="12,743,420,9" Style="{StaticResource ButtonStyleSoundOn}"/>
		</Grid>
 
	</Viewbox>
 
</phone:PhoneApplicationPage>